/**
 * websocket通讯指令封装入口
 * author: Wanghui <wangh@ciqtek.com>
 * company: ubiot.cn
 * date: 2019-08-10
 */

import callbackCache from './callback-cache'
import client from "@/service/client"

// @ts-ignore
function test({ a }) {
  let message = { type: "d3.test", data: { a } }
  return new Promise((resolve, reject) => {
    if (!client.isConnected) return reject()
    callbackCache.push("d3.test", resolve, reject)
    client.send(message)
  })
}

export default {
  test
}
